import request from "@/utils/request"
// import {get} from '@/utils/request'
// axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
export function getCategoryApi() {
  // return request.get('/category/list')
  return request.get('/category/list')
}
export function CreateCategoryApi(data) {
  return request({
    url: '/category',
    method: 'post',
    data
  })
}

export function updateCategoryApi(data) {
  return request({
    url: '/category',
    method: 'put',
    data
  })
}
export function deleteCategoryApi(query) {
  return request({
    url: '/category',
    method: 'delete',
    params: query
  })
}
export function getCategoryPageApi(query) {
  return request({
    url: '/category/page',
    method: 'get',
    params: query
  })
}

// 商品
export function getGoodListApi(data) {
  return request.get('/good/list',{params: data})
  
}
export function getGoodPageApi(query) {
  return request({
    url: '/good/page',
    method: 'get',
    params: query
  })
}
export function deleteGoodApi(data) {
  return request({
    url: '/good',
    method: 'put',
    data
  })
}
export function updateGoodApi(data) {
  return request({
    url: '/good',
    method: 'put',
    data
  })
}

// export function getGoodPageApi(data) {
//   return request.get('/good/page',data)
//   // return request.get('/good/list',data)
//   // return get('/good/list',data)
//   // return request.get('/good/list?categoryId=1413341197421846529',data)
// }
export function getGoodApi(id) {
  return request.get('/good/'+id)
  // return request.get('/good/list?categoryId=1413341197421846529',data)
}
export function addGoodApi(data) {
  return request.post('/good',data)
  // return request.get('/good/list?categoryId=1413341197421846529',data)
}